package com.erp.service.impl;

import com.erp.entity.Perms;
import com.erp.mapper.PermsMapper;
import com.erp.mapper.RolePermsMapper;
import com.erp.service.PermsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author pyj
 * @since 2020-11-07
 */
@Service
public class PermsServiceImpl implements PermsService {

    @Autowired
    private PermsMapper permsMapper;

    @Autowired
    private RolePermsMapper rolePermsMapper;
    

    @Override
    public Perms findPermsByName(String name) {
        return permsMapper.findPermsByName(name);
    }

    @Override
    public List<Perms> getAll() {
        return permsMapper.getAll();
    }

    @Override
    public int add(Perms perms) {
        return permsMapper.add(perms);
    }

    @Override
    public int delete(Integer id) {
        rolePermsMapper.deleteByPid(id);
        return permsMapper.delete(id);
    }

    @Override
    public int update(Perms perms) {
        return permsMapper.update(perms);
    }
}
